/**
 * 查看管理员信息前获取数据
 */
package controller;

import hibernate.Adminstab;
import hibernate.AdminstabDAO;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;

public class ShowAdminInfo implements Action {
	private Adminstab adminstab;

	public Adminstab getAdminstab() {
		return adminstab;
	}


	public void setAdminstab(Adminstab adminstab) {
		this.adminstab = adminstab;
	}


	public String execute() throws Exception {	
		AdminstabDAO adminstabDAO=new AdminstabDAO();
		adminstabDAO.getSession().beginTransaction();
		try
		{
			ActionContext ctx = ActionContext.getContext();
			adminstab = (Adminstab)adminstabDAO.findByAccount(ctx.getSession().get("account")).get(0);
			//ParkstabDAO parkstabDAO = new ParkstabDAO();
			//Parkstab parkstab = parkstabDAO.findById(getParkUUID());
			//adminstab.setParkstab(parkstab);

			//adminstabDAO.attachDirty(adminstab);
			adminstabDAO.getSession().getTransaction().commit();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		finally
		{
			adminstabDAO.getSession().close();
		}

		return SUCCESS;
	}

}
